<template>
  <view class="content">
    <image class="logo" src="/static/logo.png"></image>
    <view class="text-area">
      <text class="title">{{ title }}</text>
    </view>
    <view class="btn-area">
      <button class="btn" type="primary" @click="handleClick">点击测试</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";

// 响应式数据
const title = ref("Hello uni-app");

// uni-app 生命周期钩子
onLoad(() => {
  console.log("页面加载");
  // 可以在这里调用数据初始化方法
  initData();
});

onShow(() => {
  console.log("页面显示");
});

onHide(() => {
  console.log("页面隐藏");
});

// 自定义方法
function initData() {
  // 模拟数据加载
  // 实际项目中可能会调用 uni.request 等API
}

function handleClick() {
  // 按钮点击事件处理
  uni.showToast({
    title: "点击成功",
    icon: "success",
  });
}
</script>

<style scoped lang="scss">
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20rpx;
}

.logo {
  height: 200rpx;
  width: 200rpx;
  margin-top: 200rpx;
  margin-bottom: 50rpx;
}

.text-area {
  display: flex;
  justify-content: center;
  margin-bottom: 60rpx;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
  text-align: center;
}

.btn-area {
  width: 100%;
  padding: 20rpx;
}

.btn {
  width: 100%;
}
</style>
